﻿<%@ Page Title="Home" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Final._Default" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

    <style type="text/css">
        .style3
        {
            height: 81px;
        }
        .style6
        {
            width: 570px;
        }
        .style8
        {
            height: 41px;
        }
        .style9
        {
            height: 193px;
            width: 499px;
        }
        .style10
        {
            width: 545px;
        }
        .style11
        {
            width: 499px;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<!-- This place holder tag is to adding suitable stuff for suitable users "adding roles!" You can add any asp.net tag here, as long as active users or normal users need them -->

<asp:PlaceHolder runat="server" ID="ph_superUsers">
<table >
<tr valign ="middle" >
<td align ="center">
<h4>Congradulations, You Are Now A Super User!</h4>
</td>
</tr>
</table>
</asp:PlaceHolder>
         
         <div lang="en">
         <table>
         <tr>
         <td class="style10">
         <table width="547" cellspacing="30" style="border-color: #FFFF00; border-style: double;">
         <tr>
         <td class="style9">
         <table cellspacing="30" style="width: 547px; height: 121px">
         <tr align="center">
         <td valign ="middle" class="style8" >
         <h1 style="border-bottom-style: groove">Researches And Tags</h1>
         <br />
         <asp:Repeater ID="Repeater1" runat="server" DataSourceID ="TagDataSource">
         <ItemTemplate >
         <a href="Default.aspx?Tag=<%# Eval("Tag") %>">
         <%#Eval("Tag") %>
         <span style="color: #FF0000; font-weight: bold;"> | </span>
         </a>
         </ItemTemplate>
         </asp:Repeater>
         <asp:SqlDataSource ID="TagDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FinalConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FinalConnectionString.ProviderName %>" 
            SelectCommand="SELECT [Tag] FROM [Tags] ORDER BY [Tag]">
         </asp:SqlDataSource>
         </td>
         </tr>
         </table> 
         <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" Width ="550px"
         DataSourceID="ResearchTagDefaultPageDataSource" style="margin-right: 0px">
         <Columns>
           <asp:HyperLinkField DataNavigateUrlFields="ID" 
         DataNavigateUrlFormatString="~/ResearchListDetails.aspx?ID={0}" 
         DataTextField="Title" HeaderText="Research Title">
             <ControlStyle CssClass="maintitle" />
         <ItemStyle Width="200px" HorizontalAlign="Center" VerticalAlign="Middle" />
         </asp:HyperLinkField>


         <asp:BoundField DataField="AddedBy" HeaderText="Added by" SortExpression="AddedBy" >
             <ControlStyle CssClass="gridviewitem" />
         <ItemStyle Width="30px" HorizontalAlign="Center" VerticalAlign="Middle" 
                 CssClass="gridviewitem" />
         </asp:BoundField>
         <asp:BoundField DataField="Rating" HeaderText="Rating" SortExpression="Rating" >
             <ControlStyle CssClass="gridviewitem" />
             <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="25px" 
                 CssClass="gridviewitem" />
             </asp:BoundField>
         <asp:TemplateField HeaderText="Sample Page">
         <ItemTemplate>
         <img src ='<%# Eval("FirstPagePicture") %>' height ='100px' width ='100px' />
         </a>
         </ItemTemplate>
         <ControlStyle BackColor="#669999" BorderColor="#99CCFF" BorderStyle="Groove" Height="100px" Width="100px" />
         <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
         <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
         <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="100px" />
         <ItemStyle Width="100px" />
         <EditItemTemplate>
         <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("FirstPagePicture") %>'></asp:TextBox>
         </EditItemTemplate>
         </asp:TemplateField>
         </Columns>
         <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
         <HeaderStyle BackColor="#29A4EC" Font-Bold="True" ForeColor="#F7F7F7" />
         <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
         <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
         <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
         <SortedAscendingCellStyle BackColor="#F4F4FD" />
         <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
         <SortedDescendingCellStyle BackColor="#D8D8F0" />
         <SortedDescendingHeaderStyle BackColor="#3E3277" />
         </asp:GridView>
         <asp:SqlDataSource ID="ResearchTagDefaultPageDataSource" runat="server" 
         ConnectionString="<%$ ConnectionStrings:FinalConnectionString %>" 
         ProviderName="<%$ ConnectionStrings:FinalConnectionString.ProviderName %>"
         CancelSelectOnNullParameter="False" SelectCommand="SELECT * FROM [Comments]">
         </asp:SqlDataSource>
         </td>
         </tr>
         <tr>
         <td class="style11">
         <asp:PlaceHolder ID="ph_highlights" runat="server">
         <table width="500" cellspacing="30"style="width: 547px; height: 121px">
         <tr align="center">
         <td valign="middle">
         <h1 style="border-bottom-style: groove">Highlights</h1>
         <br />
         <p>Here you can see the newest research published so far!</p>
         </td>
         </tr>
         <tr>
         <td>
         <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="HighlightsDataSource" Height ="70px" Width ="500px">
         <Columns>
        <asp:HyperLinkField DataNavigateUrlFields="ID" 
         DataNavigateUrlFormatString="~/ResearchListDetails.aspx?ID={0}" 
         DataTextField="Title" HeaderText="Research Title">
             <ControlStyle CssClass="maintitle" />
         <ItemStyle Width="200px" HorizontalAlign="Center" VerticalAlign="Middle" />
         </asp:HyperLinkField>

         <asp:BoundField DataField="University" HeaderText="University" 
                 SortExpression="University">
                 <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"  CssClass="gridviewitem"  />
         </asp:BoundField>
             <asp:BoundField DataField="FieldOfStudy" HeaderText="Field of Study" 
                 SortExpression="FieldOfStudy"> 
                 <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"  CssClass="gridviewitem" />
                 </asp:BoundField>
         </Columns>
         <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
         <HeaderStyle BackColor="#29A4EC" Font-Bold="True" ForeColor="#F7F7F7" />
         <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
         <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
         <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
         <SortedAscendingCellStyle BackColor="#F4F4FD" />
         <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
         <SortedDescendingCellStyle BackColor="#D8D8F0" />
         <SortedDescendingHeaderStyle BackColor="#3E3277" />
         </asp:GridView>
         <asp:SqlDataSource ID="HighlightsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:FinalConnectionString %>" 
          ProviderName="<%$ ConnectionStrings:FinalConnectionString.ProviderName %>" 
          
                 SelectCommand="SELECT [ID], [Title], [University], [FieldOfStudy] FROM [Researches] WHERE ID=(SELECT MAX(ID) FROM Researches)">
         </asp:SqlDataSource>
         <br />
         </td>
         </tr>
         <tr align="center">
         <td>
         <p>To see all researches available <asp:HyperLink ID="hl_allResearches" runat="server" NavigateUrl="~/ResearchList.aspx">click here</asp:HyperLink></p>
         <br />
         </td>
         </tr>
         </table>
</asp:PlaceHolder>

         </td>
         </tr>
         </table>
         <!--second clomun-->
         <td class="style6">
         <table width="250" cellspacing="30" 
                 style="border-color: #000000; border-style: groove; ">
         <tr>
         <td align ="center">
         <h1 style="border-bottom-style: groove; height: 39px;">Active Users</h1>
         <br />
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                 DataSourceID="NumberOfCommentsDataSource" Font-Bold ="True" BorderWidth="2px" >
         <Columns>
         <asp:BoundField DataField="Author" HeaderText="Researcher Name" SortExpression="Author" >
         <ControlStyle BorderStyle="Dotted" />
             <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="25px" />
         </asp:BoundField>
         <asp:BoundField DataField="NumberOfComments" HeaderText="Number of Comments" 
                 SortExpression="NumberOfComments" >
             <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="35px" />
             </asp:BoundField>
         </Columns>
         <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
         <HeaderStyle BackColor="#29A4EC" Font-Bold="True" ForeColor="#F7F7F7" />
         <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
         <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
         <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
         <SortedAscendingCellStyle BackColor="#F4F4FD" />
         <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
         <SortedDescendingCellStyle BackColor="#D8D8F0" />
         <SortedDescendingHeaderStyle BackColor="#3E3277" />
         </asp:GridView>
         <asp:SqlDataSource ID="NumberOfCommentsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:FinalConnectionString %>" 
          ProviderName="<%$ ConnectionStrings:FinalConnectionString.ProviderName %>" SelectCommand="SELECT Top 5 [Author], [NumberOfComments] FROM [NumberOfComments] WHERE NumberOfComments &gt; 2 ORDER BY NumberOfComments DESC"></asp:SqlDataSource>
         </td>
         </tr>
         <br />
         <br />
         <br />
         <tr>
         <td align ="center">
         <h1 style="border-bottom-style: groove; height: 39px;">Calender</h1>
         <br />
         <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" Width="220px">
         <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
         <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
         <OtherMonthDayStyle ForeColor="#999999" />
         <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
         <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
         <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
         <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
         <WeekendDayStyle BackColor="#CCCCFF" />
         </asp:Calendar>
         <br />
         </td>
         </tr> 
         <asp:PlaceHolder ID="ph_statistics" runat="server">
         <tr align ="center">
         <td class="style3">
         <h1 style="border-bottom-style: groove">Statistics</h1>
         <br />
         <p>Number of Tags Per Research</p>
         <asp:Chart ID="Chart1" runat="server" DataSourceID="TagResearchSqlDataSource" Height="235px" Width="226px">
         <Series>
         <asp:Series Name="Series1" ChartType="Point" XValueMember="Research_fkID" YValueMembers="NumberOfTags">
         </asp:Series>
         </Series>
         <ChartAreas>
         <asp:ChartArea Name="ChartArea1">
         </asp:ChartArea>
         </ChartAreas>
         </asp:Chart>
         <asp:SqlDataSource ID="TagResearchSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:FinalConnectionString %>" 
          ProviderName="<%$ ConnectionStrings:FinalConnectionString.ProviderName %>" 
          SelectCommand="SELECT [Research_fkID], [NumberOfTags] FROM [NumberOfTags]">
         </asp:SqlDataSource>
         </td>
         </tr>
         <tr>
         <td>To see all statistics please
         <asp:HyperLink ID="hl_statistics" runat="server" NavigateUrl="~/Statistics.aspx"> click here
         </asp:HyperLink>  
         
             </asp:PlaceHolder>
         </table>

         </td>
         </tr>
          </table>
         </div>   
</asp:Content>
